import * as API_Trade from '../../api/trade'
Page({

  /**
   * 页面的初始数据
   */
  data: {
    //京东物流信息
    express:'',
    //自营物流信息
    logisticsData: '',
    //收货地址
    address: '',
    //订单编号
    sn: ''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log('options',options);
    this.setData({
      address: options.address,
      sn: options.sn
    })
    if(options.is_jd_order === "1"){
      var logistics = JSON.parse(options.logistics)
      this.setData({
        express: logistics
      })
    }else{
      this.getExpress(options.ship_no)
    }
  },
   //查询自己物流
   getExpress(num){
    API_Trade.getExpress(num).then(res =>{
      console.log('res',res);
      this.setData({
        logisticsData: res.data
      })
    })
  },
})